package com.chen.mapper;

import com.chen.popj.entity.Samples;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SamplesMapper {

    /**
     * 添加题目关联的输入输入样例
     *
     * @param samples
     */
    void addSample(List<Samples> samples);

    /**
     * 根据题目id查询案例
     *
     * @param problemId
     * @return
     */
    @Select("select * from samples where problem_id = ${problemId}")
    List<Samples> queryById(Integer problemId);

    /**
     * 根据题目id查询输入样例
     *
     * @param problemId
     * @return
     */
    @Select("select input from samples where problem_id = #{problemId}")
    List<String> getInput(Integer problemId);
}
